package com.accp.restaurant.dao;

import com.accp.restaurant.entity.Orderdishes;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface OrderdishesDao extends JpaRepository<Orderdishes,Long> {


//    @Query(value = "select * from orderDishes od where od.roomid = :roomid group by od.roomid",nativeQuery = true)
//    public Orderdishes getDistinctByRoom_Roomid(@Param("roomid") long roomid);

    public List<Orderdishes> findByRoom_Roomid(long roomid);

    public Orderdishes queryByRoom_Roomid(long roomid);


    public List<Orderdishes> findAllByRoom_Roomid(long roomid);

    public Orderdishes findAllByDishes_Dishesid(long dishesid);
    Orderdishes findByRoom_RoomidAndDishes_Dishesid(long roomid,long dishesid);

    int deleteByDishes_Dishesid(Long dishesId);
}
